local lianying = fk.CreateSkill {

  name = "joyex__lianying",

  tags = {  },

}



lianying:addEffect(fk.AfterCardsMove, {
  name = "joyex__lianying",
  anim_type = "drawcard",
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(lianying.name) then return end
    if not player:isKongcheng() then return end
    for _, move in ipairs(data) do
      if move.from == player then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerHand then
            return true
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if not player.dead then
      player:drawCards(2,lianying.name)
    end
    local to,card = room:askForChooseCardAndPlayers(player,table.map(player.room:getOtherPlayers(player), function(p)
      return p end),1,1,".|.|.|hand","#joyex__lianying-choose",lianying.name,true)
    if #to > 0 then
      local get = Fk:getCardById(card)
      local p = room:getPlayerById(to[1])
      room:moveCardTo(get, Player.Hand, p, fk.ReasonGive, lianying.name, nil, false)
    end
  end,
})

return lianying